//
//  SpImageModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/7.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "SpImageModelCell.h"
#import "BigImageView.h"
@interface SpImageModelCell ()
@property (weak, nonatomic) IBOutlet UIImageView *imgsrcView;

@property (weak, nonatomic) IBOutlet UILabel *titleLable;
@property (weak, nonatomic) IBOutlet UILabel *digestLable;


@end

@implementation SpImageModelCell

-(void)layoutSubviews{
    
    self.titleLable.text = self.model.title;
    self.digestLable.text = self.model.digest;
    self.imgsrcView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.model.imgsrc]]];
    
    self.imgsrcView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imgsrcViewAction:)];
    [self.imgsrcView addGestureRecognizer:tap];
}
- (void)imgsrcViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.imgsrcView];
}

+(CGFloat)height{
    return 120;
    
}

-(void)setModel:(SpImageModel *)model{
    if (_model != model) {
        _model = model;
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
